#region Summary 

// 
// Owner : JackieHan 
// 
// Solution : LearnSolution 
// 
// Project : JackieHan.DotNet.ExtensionMethods 
// 
// File : TestClass.cs 
// 
// CopyRight : Copyright © 2009-2010 JackieHan Personal, All Rights Reserved 
// 
// Summary : 测试类 
// 
// History : 
//			2010-05-19 16:45:06	    Create 
// 

#endregion

#region Using 

using System;
using System.Collections.Generic;
using NUnit.Framework;

#endregion

namespace JackieHan.DotNet.ExtensionMethods.ExtensionIList
{
    /// <summary> 
    /// 测试类 
    /// </summary> 
    [TestFixture]
    public class TestClass
    {
        private List<Book> books = new List<Book>();

        [SetUp]
        public void Initialize()
        {
            Book book = new Book
                            {
                                Id = 1,
                                Title = "Design Patterns",
                                Authors = new List<string> {"Erich Gamma", "Richard Helm", "ralph Johnson"}
                            };
            books.Add(book);

            book = new Book
                       {
                           Id = 2,
                           Title = "Refactoring",
                           Authors = new List<string> {"Martin Fowler"}
                       };
            books.Add(book);
        }

        [Test]
        public void Test()
        {
            books.Sort((x, y) => x.Authors.Count - y.Authors.Count);
            Assert.AreEqual(books[0].Id,2);
            bool contain = books.Contains(new Book {Id = 1}, (x, y) => x.Id == y.Id);
            Assert.AreEqual(contain, true);
        }
    }
}
